package com.cqgc.service.impl;
import com.cqgc.mapper.LogsMapper;
import com.cqgc.pojo.dto.LogsDTO.LogsParm;
import com.cqgc.pojo.entity.Logs;
import com.cqgc.pojo.entity.PageResult;
import com.cqgc.service.LogsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class LogsServiceImpl implements LogsService {
    @Autowired
    private LogsMapper logsMapper;
    @Override
    public PageResult list(LogsParm logsParm) {
        PageHelper.startPage(logsParm.getCurrentPage(),logsParm.getPageSize());
        List<Logs> logsList = logsMapper.pageQuery(logsParm);
        PageInfo pageInfo = new PageInfo(logsList);
        int total = (int) pageInfo.getTotal();
        List<Logs> list = pageInfo.getList();
        return new com.cqgc.pojo.entity.PageResult(total,list);
    }

    @Override
    public boolean removeById(int rid) {
        int i = logsMapper.deleteLog(rid);
        if (i>0){
            return true;
        }
        return false;
    }

    @Override
    public int deleteByIds(List<Long> operIds) {
        return logsMapper.deleteByIds(operIds);
    }
}
